import { Component } from '@angular/core';
import { IonicPage,NavController, NavParams } from 'ionic-angular';
import { HttpProvider } from '../../providers/http/http';
import { StorageProvider } from '../../providers/storage/storage';
import { DialogProvider } from '../../providers/dialog/dialog';
/**
 * Generated class for the Applyinputext page.
 *
 * See http://ionicframework.com/docs/components/#navigation for more info
 * on Ionic pages and navigation.
 */
@IonicPage()
@Component({
	selector: 'page-costinputext',
	templateUrl: 'costinputext.html',
})
export class CostinputextPage {

	/**
	 * 输入界面控制
	 */
	inputView = {
		applycompany: false, //申请公司
		applyproject: false, //请款项目
		applydepartment: false, //请款部门
		applyuser: false, //姓名
		applyhandler: false, //经办人
		applyloantime: false, //借款日期
		applyloannote: false, //借款用途
		applylastmonamount: false, //上月银行存款余额
		applynowamount: false, //截止目前银行存款余额
		applynowmonamount: false, //本月申请回拨区通服经费金额
		applycontractcode: false, //合同编号及标的
		applycontractamount: false, //合同总价
		applycontractnote: false, //合同约定付款条件
		applyreceptionapply: false, //申请人
		applyreceptiontag: false, //接待对象
		applyreception: false, //人数合计
		applyreceptiontime: false, //接待时间
		applyreceptionoption: false, //接待事由
		applyreceptionnone: false, //接待要求
		applyreceptionamount: false, //本次接待预算费用
		applyrcontacts: false, //联系人
		//
		applyautotype1: false, //贷款预付申请(新增)
		applyautotype2: false, //贷款支付申请(新增)
		applyautotype9: false, //员工差旅费报销审批(新增)
		applyautotype10: false, //应付贷款抵预付贷款申请(新增)
		applyautotype101: false, //应付贷款抵预付贷款申请(新增)
		//
		applyamount: false, //本次请款金额
		//
		applybankunitname: false, //收款单位名称
		applybankno: false, //银行账号
		applybankname: false, //开户银行
		applynogotnote: false, //无法取得发票原因
		//
		applyhandlernote: false, //经办部门意见
		applyaccountnote: false, //会计核准意见
		applydepartnote: false, //部门领导意见
		applyreceptionrepartnone: false, //对口接待部门意见
		applyofficenote: false, //综合办公室意见
		applydepartmentnote: false, //请款部门意见
		applyfinancialnote: false, //财务部意见
		applyleadershipnote: false, //公司分管领导意见
		applyefficnote: false, //效能监察意见
		applymanagernote: false, //公司总经理意见
		applyreceptionnumbers: false, //申请人填写实际接待人数
		//
		applynextlink: false, //下一步处理环节
		applynextman: false, //下一步处理人
		applyuploadfile: false, //附件
	}
	/**
	 * 输入界面控制
	 */
	inputViewName = {
		applycompany: '申请公司', //申请公司
		applyproject: '请款项目', //请款项目
		applydepartment: '请款部门', //请款部门
		applyuser: '姓名', //姓名
		applyhandler: '经办人', //经办人
		applyloantime: '借款日期', //借款日期
		applyloannote: '借款用途', //借款用途
		applylastmonamount: '上月银行存款余额', //上月银行存款余额
		applynowamount: '截止目前银行存款余额', //截止目前银行存款余额
		applynowmonamount: '本月申请回拨区通服经费金额', //本月申请回拨区通服经费金额
		applycontractcode: '合同编号及标的', //合同编号及标的
		applycontractamount: '合同总价', //合同总价
		applycontractnote: '合同约定付款条件', //合同约定付款条件
		applyreceptionapply: '申请人', //申请人
		applyreceptiontag: '接待对象', //接待对象
		applyreception: '人数合计', //人数合计 男/女
		applyreceptiontime: '接待时间', //接待时间
		applyreceptionoption: '接待事由', //接待事由
		applyreceptionnone: '接待要求', //接待要求
		applyreceptionamount: '本次接待预算费用', //本次接待预算费用
		applyrcontacts: '联系人', //联系人-姓名/电话

		//
		applyamount: '本次请款金额', //本次请款金额
		//
		applybankunitname: '收款单位名称', //收款单位名称
		applybankno: '银行账号', //银行账号
		applybankname: '开户银行', //开户银行
		applynogotnote: '无法取得发票原因', //无法取得发票原因
		//
		applyhandlernote: '经办部门意见', //经办部门意见
		applyaccountnote: '会计核准意见', //会计核准意见
		applydepartnote: '部门领导意见', //部门领导意见
		applyreceptionrepartnone: '对口接待部门意见', //对口接待部门意见
		applyofficenote: '综合办公室意见', //综合办公室意见
		applydepartmentnote: '请款部门意见', //请款部门意见
		applyfinancialnote: '财务部意见', //财务部意见
		applyleadershipnote: '公司分管领导意见', //公司分管领导意见
		applyefficnote: '效能监察意见', //效能监察意见
		applymanagernote: '公司总经理意见', //公司总经理意见
		applyreceptionnumbers: '申请人填写实际接待人数', //申请人填写实际接待人数
		//
		applynextlink: '下一步处理环节', //下一步处理环节
		applynextman: '下一步处理人', //下一步处理人
		applyuploadfile: '附件', //附件
	}
	/**
	 * 输入界面控制
	 */
	inputViewModel = {
		applycompany: '', //申请公司
		applyproject: '', //请款项目
		applydepartment: '', //请款部门
		applyuser: '', //姓名
		applyhandler: '', //经办人
		applyloantime: '', //借款日期
		applyloannote: '', //借款用途
		applylastmonamount: '', //上月银行存款余额
		applynowamount: '', //截止目前银行存款余额
		applynowmonamount: '', //本月申请回拨区通服经费金额
		applycontractcode: '', //合同编号及标的
		applycontractamount: '', //合同总价
		applycontractnote: '', //合同约定付款条件
		applyreceptionapply: '', //申请人
		applyreceptiontag: '', //接待对象
		applyreceptionsum: '', //人数合计
		applyreceptionman: '', //人数-男
		applyreceptionfel: '', //人数-女
		applyreceptiontime: '', //接待时间
		applyreceptionoption: '', //接待事由
		applyreceptionnone: '', //接待要求
		applyreceptionamount: '', //本次接待预算费用
		applyrcontactsname: '', //联系人-姓名
		applyrcontactstel: '', //联系人-电话
		//
		applyautotype1items: new Array(), //贷款预付申请(新增)
		applyautotype2items: new Array(), //贷款支付申请(新增)
		applyautotype9items: new Array(), //员工差旅费报销审批(新增)
		applyautotype10items: new Array(), //应付贷款抵预付贷款申请(新增)
		applyautotype101items: new Array(), //应付贷款抵预付贷款申请(新增)
		//
		applyamountMax: '', //本次请款金额(大写)
		applyamountMin: '', //本次请款金额(小写)
		//
		applybankunitname: '', //收款单位名称
		applybankno: '', //银行账号
		applybankname: '', //开户银行
		applynogotnote: '', //无法取得发票原因
		//
		applyhandlernote: '', //经办部门意见
		applyaccountnote: '', //会计核准意见
		applydepartnote: '', //部门领导意见
		applyreceptionrepartnone: '', //对口接待部门意见
		applyofficenote: '', //综合办公室意见
		applydepartmentnote: '', //请款部门意见
		applyfinancialnote: '', //财务部意见
		applyleadershipnote: '', //公司分管领导意见
		applyefficnote: '', //效能监察意见
		applymanagernote: '', //公司总经理意见
		applyreceptionnumbers: '', //申请人填写实际接待人数
		//
		applynextlink: '', //下一步处理环节
		applynextman: '', //下一步处理人
		applyuploadfile: '', //附件
	}

	/**
	 * 页面类型
	 */
	private type: Number;
	/**
	 * 标题
	 */
	private title: String;

			constructor(
		public navCtrl: NavController,
		public navParams: NavParams,
		public http: HttpProvider,
		public storage: StorageProvider,
		public dialog: DialogProvider) {
		this.type = this.navParams.get("type"); //页面类型
	}

	ionViewDidLoad() {
		console.log('ionViewDidLoad Applyinputext');
		//控制显示
		this.ionViewDidShow();
	}

	ionViewDidShow() {
		//1.贷款预付申请
		if(this.type == 1) {
			this.title = '贷款预付申请';
			this.inputView.applycompany = true;
			this.inputView.applyproject = true;
			this.inputView.applydepartment = true;
			this.inputView.applyhandler = true;
			this.inputView.applycontractcode = true;
			this.inputView.applycontractamount = true;
			this.inputView.applycontractnote = true;
			this.inputView.applyautotype1 = true;
			this.inputView.applyamount = true;
			this.inputView.applybankunitname = true;
			this.inputView.applybankno = true;
			this.inputView.applybankname = true;
			this.inputView.applydepartmentnote = true;
			this.inputView.applyfinancialnote = true;
			this.inputView.applyleadershipnote = true;
			this.inputView.applyefficnote = true;
			this.inputView.applymanagernote = true;
			this.inputView.applynextlink = true;
			this.inputView.applynextman = true;
			this.inputView.applyuploadfile = true;
		}
		//2.贷款支付申请
		if(this.type == 2) {
			this.title = '贷款支付申请';
			this.inputView.applycompany = true;
			this.inputView.applyproject = true;
			this.inputView.applydepartment = true;
			this.inputView.applyhandler = true;
			this.inputView.applycontractcode = true;
			this.inputView.applycontractamount = true;
			this.inputView.applycontractnote = true;
			this.inputView.applyautotype2 = true;
			this.inputView.applyamount = true;
			this.inputView.applybankunitname = true;
			this.inputView.applybankno = true;
			this.inputView.applybankname = true;
			this.inputView.applydepartmentnote = true;
			this.inputView.applyfinancialnote = true;
			this.inputView.applyleadershipnote = true;
			this.inputView.applyefficnote = true;
			this.inputView.applymanagernote = true;
			this.inputView.applynextlink = true;
			this.inputView.applynextman = true;
			this.inputView.applyuploadfile = true;
		}
		//3.费用预付审批
		if(this.type == 3) {
			this.title = '费用预付审批';
			this.inputView.applycompany = true;
			this.inputView.applyproject = true;
			this.inputView.applydepartment = true;
			this.inputView.applyhandler = true;
			this.inputView.applycontractcode = true;
			this.inputView.applycontractamount = true;
			this.inputView.applycontractnote = true;
			this.inputView.applyamount = true;
			this.inputView.applybankunitname = true;
			this.inputView.applybankno = true;
			this.inputView.applybankname = true;
			this.inputView.applydepartmentnote = true;
			this.inputView.applyfinancialnote = true;
			this.inputView.applyleadershipnote = true;
			this.inputView.applyefficnote = true;
			this.inputView.applymanagernote = true;
			this.inputView.applynextlink = true;
			this.inputView.applynextman = true;
			this.inputView.applyuploadfile = true;
		}
		//4.费用支付审批
		if(this.type == 4) {
			this.title = '费用支付审批';
			this.inputView.applycompany = true;
			this.inputView.applyproject = true;
			this.inputView.applydepartment = true;
			this.inputView.applyhandler = true;
			this.inputView.applycontractcode = true;
			this.inputView.applycontractamount = true;
			this.inputView.applycontractnote = true;
			this.inputView.applyamount = true;
			this.inputView.applybankunitname = true;
			this.inputView.applybankno = true;
			this.inputView.applybankname = true;
			this.inputView.applydepartmentnote = true;
			this.inputView.applyfinancialnote = true;
			this.inputView.applyleadershipnote = true;
			this.inputView.applyefficnote = true;
			this.inputView.applymanagernote = true;
			this.inputView.applynextlink = true;
			this.inputView.applynextman = true;
			this.inputView.applyuploadfile = true;
		}
		//5.接待申请
		if(this.type == 5) {
			this.title = '接待申请';
			this.inputView.applycompany = true;
			this.inputView.applyreceptionapply = true;
			this.inputView.applyreceptiontag = true;
			this.inputView.applyreception = true;
			this.inputView.applyreceptiontime = true;
			this.inputView.applyreceptionoption = true;
			this.inputView.applyreceptionnone = true;
			this.inputView.applyreceptionamount = true;
			this.inputView.applyrcontacts = true;
			this.inputView.applyreceptionrepartnone = true;
			this.inputView.applyofficenote = true;
			this.inputView.applyleadershipnote = true;
			this.inputView.applymanagernote = true;
			this.inputView.applyreceptionnumbers = true;
			this.inputView.applynextlink = true;
			this.inputView.applynextman = true;
			this.inputView.applyuploadfile = true;
		}
		//6.借款申请
		if(this.type == 6) {
			this.title = '借款申请';
			this.inputViewName.applycompany = '借款公司';
			this.inputView.applycompany = true;
			this.inputViewName.applydepartment = '借款部门';
			this.inputView.applydepartment = true;
			this.inputViewName.applyhandler = '借款人';
			this.inputView.applyhandler = true;
			this.inputView.applyloantime = true;
			this.inputView.applyloannote = true;
			this.inputViewName.applyamount = '借款金额';
			this.inputView.applyamount = true;
			this.inputViewName.applybankunitname = '收款单位名称';
			this.inputView.applybankunitname = true;
			this.inputViewName.applybankno = '收款人银行账号';
			this.inputView.applybankno = true;
			this.inputViewName.applybankname = '收款人开户银行';
			this.inputView.applybankname = true;
			this.inputView.applydepartnote = true;
			this.inputView.applyfinancialnote = true;
			this.inputView.applyleadershipnote = true;
			this.inputView.applyofficenote = true;
			this.inputView.applynextlink = true;
			this.inputView.applynextman = true;
			this.inputView.applyuploadfile = true;
		}
		//7.经费回拨审批
		if(this.type == 7) {
			this.title = '经费回拨审批';
			this.inputView.applycompany = true;
			this.inputViewName.applydepartment = '部门';
			this.inputView.applydepartment = true;
			this.inputView.applyhandler = true;
			this.inputViewName.applyloannote = '用途';
			this.inputView.applyloannote = true;
			this.inputView.applylastmonamount = true;
			this.inputView.applynowamount = true;
			this.inputView.applynowmonamount = true;
			this.inputView.applyfinancialnote = true;
			this.inputView.applymanagernote = true;
			this.inputView.applynextlink = true;
			this.inputView.applynextman = true;
			this.inputView.applyuploadfile = true;
		}
		//8.理赔款支付申请
		if(this.type == 8) {
			this.title = '理赔款支付申请';
			this.inputView.applycompany = true;
			this.inputView.applyproject = true;
			this.inputView.applydepartment = true;
			this.inputView.applyhandler = true;
			this.inputViewName.applyloannote = '理赔款赔付说明';
			this.inputView.applyloannote = true;
			this.inputView.applyamount = true;
			this.inputView.applybankunitname = true;
			this.inputView.applybankno = true;
			this.inputView.applybankname = true;
			this.inputView.applydepartmentnote = true;
			this.inputView.applyfinancialnote = true;
			this.inputView.applyefficnote = true;
			this.inputView.applyleadershipnote = true;
			this.inputView.applymanagernote = true;
			this.inputView.applynextlink = true;
			this.inputView.applynextman = true;
			this.inputView.applyuploadfile = true;
		}
		//9.员工差旅费报销审批
		if(this.type == 9) {
			this.title = '员工差旅费报销审批';
			this.inputView.applycompany = true;
			this.inputView.applyuser = true;
			this.inputViewName.applydepartment = '部门';
			this.inputView.applydepartment = true;
			this.inputViewName.applyloannote = '出差事由';
			this.inputView.applyloannote = true;
			this.inputView.applyautotype9 = true;
			this.inputViewName.applycontractnote = '附注';
			this.inputView.applycontractnote = true;
			this.inputView.applyaccountnote = true;
			this.inputView.applydepartnote = true;
			this.inputView.applyleadershipnote = true;
			this.inputView.applymanagernote = true;
			this.inputView.applynextlink = true;
			this.inputView.applynextman = true;
			this.inputView.applyuploadfile = true;
		}
		//10.应付贷款抵预付贷款申请
		if(this.type == 10) {
			this.title = '应付贷款抵预付贷款申请';
			this.inputView.applycompany = true;
			this.inputViewName.applydepartment = '经办部门';
			this.inputView.applydepartment = true;
			this.inputView.applyhandler = true;
			this.inputView.applyautotype10 = true;
			this.inputView.applyautotype101 = true;
			this.inputView.applyhandlernote = true;
			this.inputView.applynextlink = true;
			this.inputView.applynextman = true;
			this.inputView.applyuploadfile = true;
		}
		//11.无票成本费用列支付申请
		if(this.type == 11) {
			this.title = '无票成本费用列支付申请';
			this.inputView.applycompany = true;
			this.inputViewName.applydepartment = '申请部门';
			this.inputView.applydepartment = true;
			this.inputViewName.applyhandler = '申请人';
			this.inputView.applyhandler = true;
			this.inputViewName.applyloannote = '申请列支内容';
			this.inputView.applyloannote = true;
			this.inputViewName.applyamount = '列支金额';
			this.inputView.applyamount = true;
			this.inputView.applynogotnote = true;
			this.inputViewName.applyhandlernote = '申请部门意见';
			this.inputView.applyhandlernote = true;
			this.inputView.applyfinancialnote = true;
			this.inputView.applyefficnote = true;
			this.inputView.applyleadershipnote = true;
			this.inputView.applymanagernote = true;
			this.inputView.applynextlink = true;
			this.inputView.applynextman = true;
			this.inputView.applyuploadfile = true;
		}
	}

	ionViewDidAddAuto(type) {
		//1.贷款预付申请
		if(type == 1) {
			let obj = new Object();
			obj['num'] = this.inputViewModel.applyautotype1items.length + 1;
			obj['time'] = ''; //请款时间
			obj['value'] = ''; //金额
			this.inputViewModel.applyautotype1items.push(obj);
		}
		//2.贷款支付申请
		if(type == 2) {
			let obj = new Object();
			obj['num'] = this.inputViewModel.applyautotype2items.length + 1;
			obj['time'] = ''; //请款时间
			obj['value'] = ''; //金额
			this.inputViewModel.applyautotype2items.push(obj);
		}
		//9.员工差旅费报销审批
		if(type == 9) {
			let obj = new Object();
			obj['code'] = ''; //未报销单号
			obj['starttime'] = ''; //开始日期
			obj['endtime'] = ''; //截止日期
			obj['startaddress'] = ''; //起点
			obj['endaddress'] = ''; //终点
			obj['traffic'] = ''; //交通工具
			obj['days'] = ''; //天数
			obj['price'] = ''; //交通工具票价
			obj['fees'] = ''; //杂费
			obj['hotel'] = ''; //住宿费
			obj['meal'] = ''; //膳补费
			obj['sum'] = ''; //合计
			this.inputViewModel.applyautotype9items.push(obj);
		}
		//10.贷款支付申请
		if(type == 10) {
			let obj = new Object();
			obj['num'] = this.inputViewModel.applyautotype10items.length + 1;
			obj['time'] = ''; //请款时间
			obj['value'] = ''; //金额
			this.inputViewModel.applyautotype10items.push(obj);
		}
		//101.贷款支付申请
		if(type == 101) {
			let obj = new Object();
			obj['num'] = this.inputViewModel.applyautotype101items.length + 1;
			obj['time'] = ''; //请款时间
			obj['value'] = ''; //金额
			obj['incode'] = ''; //入库单据号
			obj['outcode'] = ''; //供应商发票号
			this.inputViewModel.applyautotype101items.push(obj);
		}
	}
}